1. Field of the Invention
The present invention relates to a task management system in an operation system for executing a plurality of tasks in parallel.
2. Description of the Related Art
There has conventionally been known a task management system which achieves switching of tasks when a plurality of tasks are executed on an electronic computer by switching at a high speed to realize parallel processing. The task management system is a subsystem of an operating system of the electronic computer.
Referring to FIGS. 1 to 5, the related task management system will be described. FIG. 1 is a block diagram showing a configuration of a related task management system 100.
As shown in FIG. 1, the related task management system 100 includes a task management unit 110, and a storage unit 120.
The task management unit 110 includes a management function 111, a task interrupting function 112, a task resuming function 113, and a task switching function 114.
The management function 111 is configured to control executions of the task interrupting function 112, the task resuming function 113, and the task switching function 114.
The task interrupting function 112 is configured to change a task of an executed state to an execution standby state.
The task resuming function 113 is configured to change the task of an execution standby state to an executed state.
The task switching function 114 is configured to select a task whose execution is resumed, and to switch a task address space.
The storage unit 120 includes a task information storage area 121, and a plurality of task address spaces 122-1 to 122-n. 
The task information storage area 121 is an area for storing to associate a task number to identify each task with task information to indicate a state of each task.
The task information contain contents of a register of a central processing unit (CPU), data necessary for resuming execution of the task, such as am identification of a task address space used by the task, and management data on a priority of the task, total execution time or the like.
The task address spaces 122-1 to 122-n are for managing task address spaces which are address spaces of the tasks. The task address space is a logical address space generally different from one task to another.
In other words, even in the case of the same address, a physical address space to be actually accessed generally varies from one task to another (permitted to be similar).
Hereinafter, an operation of the related task management system will be described.
FIG. 2 is a flowchart illustrating processing when the management function 111 of the related task system 100 performs task switching.
As shown in FIG. 2, in a step S101, when executing task switching, the management function 111 instructs the task interrupting function 112 to change a task of a currently executed state to an execution standby state. The task of the executed state will be referred to as a “task A” hereinafter.
In a step S102, the management function 111 instructs the task switching function 114 to select a task which is a target of next execution resumption, and to switch a task address space. The task selected as the execution resumption target will be referred to as a “task B” hereinafter.
In a step S103, the management function 111 instructs the task resuming function 113 to set the task B to an executed state, and finishes the processing.
FIG. 3 is a flowchart illustrating processing when the task interrupting function 112 of the related task management system 100 performs task switching.
As shown in FIG. 3, in a step S101A, the task interrupting function 112 changes the task (task A) of the currently executed state to an execution standby state according to the instruction from the management function 111 in the step S101.
In a step S102A, the task interrupting function 112 stores task information of the task A in the task information storage area 121.
FIG. 4 is a flowchart illustrating processing when the task switching function 114 of the related task management system 100 performs task switching.
As shown in FIG. 4, in a step S101B, the task switching function 114 refers, according to the instruction from the management function 111 in the (step S102, to the task information storage area 121, considers fairness, a priority or the like among the tasks, and decides a task (task B) which becomes a target of execution resumption among the tasks processed by the task management system 100.
In a step S102B, the task switching function 114 switches a task address space, so as to enable use of a task address space previously used in the executed slate of the task B.
Specifically, the task switching function 114 executes task address space switching by a change in setting of a mechanism of associating logical and physical addresses with each other such as a change in setting of a segment register of the CPU or the page table.
However, in an electronic computer (i.e., system where a physical address is the only address space) which does not use the address associating mechanism, when each divided portion of a physical address space is set as a task address space, setting processing of task address space switching is not necessary.
FIG. 5 is a flowchart illustrating processing when the task resuming function 113 of the related task management system 100 performs task switching.
As shown in FIG. 5, in a step S101C, the task resuming function 113 obtains the task information of the task B from the task information storage area 121 according to the instruction from the management function 111 in the step S103.
The task resuming function 113 sets register contents of the CPU based on the obtained task information in the step S102C, and resumes the execution of the task B in a step S103C.
As examples of the aforementioned related task management system 100, there have been known a system which includes a task switch control function, a task interrupting function and a task resuming function, and a multitask OS such as UNIX (registered trademark).
However, the related task management system has had a problem that even if a change occurs in data stored in the task address space of the task to affect processing of the task in the period of the execution standby state of the task, the change cannot be detected.
Thus, illegal rewriting of important data by other tasks is overlooked without being detected, consequently affecting task processing which uses the data.